package ucd.csi.comp30220.fall2011.oteop.collision;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;
import ucd.csi.comp30220.fall2011.oteop.flight.FlightStatus;
import ucd.csi.comp30220.fall2011.oteop.navigation.Position;

/**
 * Collision Information.
 * Objects of this class contain information on a specific collision
 * 
 * @author David Haddock
 * @author David Harrison
 */
public class CollisionInfo implements Collision, Serializable {

		private static final long serialVersionUID = -1720141971912534326L;
        private Position position;
        private int altitude;
        private Date expectedAt;
        private Date detectedAt;
        private FlightStatus flightOne;
        private FlightStatus flightTwo;
        
        /**
         * Contains information on a specific collision
         * @param position The Position
         * @param altitude The altitude
         * @param expectedAt The date the collision is expected
         * @param detectedAt The date the collision was detected
         */
        public CollisionInfo(
                Position position,
                int altitude,
                Date expectedAt,
                Date detectedAt,
                FlightStatus flightOne,
                FlightStatus flightTwo) {
            this.position = position;
            this.altitude = altitude;
            this.expectedAt = expectedAt;
            this.detectedAt = detectedAt;
            this.flightOne = flightOne;
            this.flightTwo = flightTwo;      
        }
        
        public Position position() {
            return position;
        }
        
        public int altitude() {
            return altitude;
        }
        
        public Date expectedAt() {
            return expectedAt;
        }
        
        public Date detectedAt() {
            return detectedAt;
        }
        
        public String toString() {
            return "(" +detectedAt +") " + position + ", " +altitude +"ft, " +expectedAt;
        }

		public Collection<FlightStatus> flights() {
			Collection<FlightStatus> fly = new LinkedList<FlightStatus>();
			fly.add(flightOne);
			fly.add(flightTwo);
			return fly;
		}
  }